home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
009
/
eqpat01.arc
/
PSHERC.ASM
< prev
next >
Wrap
Assembly Source File
|
1986-10-10
|
3KB
|
112 lines
PAGE 60,132
TITLE PSHERC
; Program to let Print Shop from Broderbund use
; Equity II Hercules mode.
; The program stays resident in memory and does not let
; programs use the BIOS to set video mode 4 (320x200
; color) through INT 10h, function 0.
; DOS definitions
dos equ 21h ;dos interrupt
term_res equ 31h ;terminate but stay resident
terminate equ 4ch ;terminate process
set_vector equ 25h ;set interrupt vector
get_vector equ 35h ;get interrupt vector
display_str equ 09 ;display string
; Interrupt numbers
video_int equ 10h
; Control characters
cr equ 0dh
lf equ 0ah
code segment para 'CODE'
assume cs:code,ds:nothing,es:nothing,ss:nothing
org 100h
begin: jmp short start
pshercfix proc far
new_video_int: ;BIOS video (INT 10H) is redirected here.
;Check to see if user program is requesting
;set 320x200 mode (mode 4)
cmp ah,0 ;set video mode?
jnz go_vid ;no, just continue
cmp al,4 ;set 320x200 mode?
jnz go_vid ;if not, goto video int
iret ;don't let mode 4 happen!!
go_vid: jmp dword ptr cs:old_video_int ;go to real int 10h
sig_offset equ $ - new_video_int
res_sig: db 'PSHercFix'
sig_len equ $ - res_sig
old_video_int dd ?
last equ $-1 ;mark end of resident code
pshercfix endp
assume ds:code
start proc near ;redirect video int to point to
;new_video_int and save current vector
mov sp,offset stack
call chk_res ;see if we're resident already
;returns interrupt address in ES:BX
mov word ptr old_video_int,bx ;store offset
mov word ptr old_video_int[2],es ;store segment
mov dx,offset new_video_int ;DS:DX is now new int address
mov al,video_int ;video interrupt #
mov ah,set_vector ;set vector func
int dos ;set int 10h to new_video_int
mov dx,offset last ;byte count of code to stay resident
mov cl,4
shr dx,cl ;change to paragraph count
inc dx ;just to be sure
mov ah,term_res ;stay resident
mov al,0 ;return code of 0
int dos ;that's all folks
start endp
chk_res proc near ;check if pshercfix routine resident
;if not, returns current video interrupt
;in ES:BX
mov ah,get_vector
mov al,video_int ;video interrupt
int dos ;get video interrupt vector in es:bx
mov di,sig_offset ;offset of signature bytes from int offset
add di,bx ;add in interrupt offset
mov si,offset res_sig ;point to sig bytes
mov cx,sig_len ;length of sig
cld
repz cmpsb ;is it there?
jz its_there
ret ;back to main program
its_there: ;print already resident message
pop ax ;clean up stack
mov dx,offset there_mes
mov ah,display_str
int dos ;display message
mov ah,terminate ;normal end of process
mov al,0
int dos ;back to calling process
there_mes:
db cr,lf,'Already resident ...',cr,lf,'$'
chk_res endp
EVEN
stk: db 16 dup('STACK...')
stack label word
code ends
end begin